<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-07-04 17:08
 *
 * Version: 2.0
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Royalty extends Model
{
	protected $table="royalty";
	protected $guarded = [];

	public function order(){
		if($this->type==1){
			return $this->hasOne(Order::class, 'id', 'item_id');
		}
	}

    public function item()
    {
        return $this->morphTo();
    }

    public function orders()
    {
        return $this->hasOne(Order::class,'id','item_id');
    }

    public function memberCard()
    {
        return $this->hasOne(MemberCard::class,'id','item_id');
    }

    public function GoodsOrder()
    {
        return $this->hasOne(GoodsOrder::class,'id','item_id');
    }
}